import java.util.*;

class Program {
  // This is an input class. Do not edit.
  static class BST {
    public int value;
    public BST left = null;
    public BST right = null;

    public BST(int value) {
      this.value = value;
    }
  }

  public int findKthLargestValueInBst(BST tree, int k) {
    List<Integer> list = new ArrayList<>();
    inOrderTraversal(tree, list);
    return list.get(list.size() - k);
  }

  private void inOrderTraversal(BST tree, List<Integer> list) {
    if(tree == null) {
      return;
    }

    inOrderTraversal(tree.left, list);
    list.add(tree.value);
    inOrderTraversal(tree.right, list);
  


  }

}
